package com.lzy.cloud.payment.service.impl;

import com.lzy.cloud.payment.dtos.payment.PayInfoDetailDto;
import com.lzy.cloud.payment.entity.PayInfoDetail;
import com.lzy.cloud.payment.mapper.PayInfoDetailMapperExt;
import com.lzy.cloud.payment.service.PayInfoDetailService;
import com.lzy.cloud.payment.utils.CommonsUtil;
import com.lzy.framework.core.utils.DozerUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PayInfoDetailServiceImpl implements PayInfoDetailService {

    @Autowired
    PayInfoDetailMapperExt payInfoDetailMapperExt;

    @Override
    public boolean createPayInfoDetail(PayInfoDetailDto payInfoDetailDto) {
        int count = payInfoDetailMapperExt.insert(DozerUtils.map(payInfoDetailDto,PayInfoDetail.class));
        return !CommonsUtil.isEmpty(count);
    }

    @Override
    public boolean updatePayInfoDetail(PayInfoDetailDto payInfoDetailDto) {
        return payInfoDetailMapperExt.updateByPrimaryKeySelective(DozerUtils.map(payInfoDetailDto,PayInfoDetail.class))>0;
    }

    @Override
    public PayInfoDetailDto selectByOrderId(String orderId) {
        return payInfoDetailMapperExt.selectByOrderId(orderId);
    }
}
